<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:c="http://www.springframework.org/schema/beans">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script th:src="@{/js/jquery-3.4.1.min.js}" charset="utf-8"></script>
    <link rel="stylesheet" th:href="@{/css/layui.css}"  media="all">
    <script th:src="@{/js/layui.js}" charset="utf-8"></script>
    <script th:src="@{/js/rollpage.js}" charset="utf-8"></script>
    <script>
        function show() {
            alert("该用户已离职了")
        }
        var  list;
    </script>
</head>
<body>


<div style="margin-top: 10px">
    <button type="button" class="layui-btn layui-btn-normal" onclick="window.location.href='/check/main'">返回上一级</button>
</div>


<div>
    <table class="table table-hover table-striped">
        <thead>
        <tr>
            <th>用户名称</th>
            <th>联系电话</th>
            <th>电子邮箱</th>
            <th>状态</th>
            <th>时间</th>
            <th>职业</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>

        <!--<tr th:each="user : ${userList}">-->
        <!--<td th:text="${user.name}">xxx</td>-->

        <!--</tr>-->

        <tr th:each="Employee : ${list}">
            <td>[[${Employee.getName()}]]</td>
            <td>[[${Employee.getPhone()}]]</td>
            <td>[[${Employee.getEmail()}]]</td>
            <td>[[${Employee.getState()}]]</td>
            <!--<td th:text="${#dates.format(user.birthday, 'yyyy-MM-dd HH:mm')}"></td>-->
            <td th:text="${#dates.format(Employee.getTime(),'yyyy-MM-dd HH:mm:ss')}"></td>
            <td>[[${Employee.getJob()}]]</td>
            <td >
                  <span th:switch="${Employee.getState()}">
                       <a th:case="离职" οnclick=" return false;" onmouseout="show()">删除</a>
                       <a th:case="在职" th:href="@{/emp/del(id=${Employee.getId()},pageIndex=${currentPageNo})}">删除</a>
                  </span>
                <span>
                      |<a th:href="@{/emp/update(id=${Employee.getId()})}">更改</a>
                  </span>

            </td>
        </tr>
        </tbody>
    </table>
</div>
<div>
    <div>
        <input type="hidden" name="pageIndex" th:value="${currentPageNo}"/>
        <input type="hidden" id="totalPageCount" th:value="${totalPageCount}"/>
    </div>

    <div style="float: left;margin-left: 0px">
        <ul style="margin-left: 0px">
            <li style="list-style: none">共[[${totalCount}]]条记录&nbsp;&nbsp; [[${currentPageNo}]]/[[${totalPageCount}]]页
            </li>
        </ul>
    </div>
    <div style="float: left" th:if="${currentPageNo} gt 1">
        <a th:href="@{/query/all(pageIndex=1)}">首页</a>
        <a th:href="@{/query/all(pageIndex=${currentPageNo}-1)}">上一页</a>
    </div>
    <div style="float: left" th:if="${currentPageNo} lt  ${totalPageCount}">
        <a th:href="@{/query/all(pageIndex=${currentPageNo}+1)}">下一页</a>
        <a th:href="@{/query/all(pageIndex=${totalPageCount})}">最后一页</a>
    </div>
    <div style="float: left"></div>
    <div style="float: right">
         <span><label>跳转至</label>
	     <input type="text" name="inputPage" id="inputPage" class="page-key" />页
	     <button type="button" class="page-btn" onClick='jump_to(document.forms[0],document.getElementById("inputPage").value)'>GO</button>
    </span>

    </div>


</div>
</body>
</html>